﻿<loki:RibbonViewWindow
    x:TypeArguments="luna:MainViewModel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loki="clr-namespace:Loki.UI.Wpf;assembly=Loki.UI.Wpf"
    xmlns:lc="clr-namespace:Loki.Commands;assembly=Loki.Core"
    xmlns:luna="clr-namespace:Luna.UI;assembly=Luna.Core"
    xmlns:local="clr-namespace:Luna.UI.Wpf"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ve="http://schemas.devexpress.com/winfx/2008/xaml/docking/visualelements"
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
    mc:Ignorable="d"
    x:Class="Luna.WPF.MainWindow"
    Title="Luna" Height="566.8" Width="932.2" WindowStartupLocation="CenterOwner" WindowState="Maximized"
    Icon="Resources/Moon_Phase_Full.png">
    <Window.Resources>
        <Style TargetType="dxb:BarButtonItem" x:Key="MNI_Style">
            <Setter Property="RibbonStyle" Value="Default" />
            <Setter Property="BarItemDisplayMode" Value="Default" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.New.Category">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_add}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.New.Account">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_add}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.New.Contact">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_add}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Save">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_save}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Refresh">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_refresh}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Navigation.Accounts">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_accounts}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Navigation.Contacts">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_contacts}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Navigation.Categories">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_accounts}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Google.Refresh">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_google}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Command.Tag}" Value="Application.Zoho.Refresh">
                    <Setter Property="LargeGlyph" Value="{StaticResource MNI_zoho}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <DataTemplate x:Key="itemTemplate">
            <ContentControl>
                <dxb:BarButtonItem Style="{StaticResource MNI_Style}"
                    Content="{Binding Name}"
                    Command="{Binding Command}" />
            </ContentControl>
        </DataTemplate>
        <Style x:Key="pageStyle" TargetType="dxr:RibbonPage">
        </Style>
        <DataTemplate x:Key="groupTemplate">
            <ContentControl>
                <dxr:RibbonPageGroup
                    ItemLinksSource="{Binding Commands}"
                    Caption="{Binding Name}"
                    ItemTemplate="{StaticResource itemTemplate}"
                    ShowCaptionButton="False"
                    AllowCollapse="True" />
            </ContentControl>
        </DataTemplate>
        <DataTemplate x:Key="pageTemplate">
            <ContentControl>
                <dxr:RibbonPage
                    GroupsSource="{Binding Groups}"
                    Caption="{Binding Name}"
                    GroupTemplate="{StaticResource groupTemplate}"
                    Style="{StaticResource pageStyle}" />
            </ContentControl>
        </DataTemplate>
        <DataTemplate x:Key="categoryTemplate">
            <ContentControl>
                <dxr:RibbonDefaultPageCategory
                     PagesSource="{Binding Pages}"
                     PageTemplate="{StaticResource pageTemplate}" />
            </ContentControl>
        </DataTemplate>
    </Window.Resources>
    <dxb:BarManager>
        <dxb:BarManager.Items>
            <dxb:BarButtonItem x:Name="MNI_ContactList" Content="Contacts" Command="luna:NavigationCommands.CONTACTS" />
            <dxb:BarButtonItem x:Name="MNI_AccountList" Content="Comptes" Command="luna:NavigationCommands.ACCOUNTS" />
            <dxb:BarButtonItem x:Name="MNI_Save" Content="Sauvegarder" Command="lc:ApplicationCommands.SAVE" />
            <dxb:BarButtonItem x:Name="barButtonItem2" Content="Google refresh" Command="luna:ApplicationCommands.GOOGLE_REFRESH" />
            <dxb:BarStaticItem x:Name="barStaticItem2" Content="{Binding StoreName}" AutoSizeMode="Fill" ShowBorder="false" />
        </dxb:BarManager.Items>
        <DockPanel>
            <dxr:RibbonControl DataContext="{Binding Ribbon}" DockPanel.Dock="Top" RibbonStyle="Office2010" CategoriesSource="{Binding Categories}"  CategoryTemplate="{StaticResource categoryTemplate}">
                <dxr:RibbonControl.ApplicationMenu>
                    <local:ApplicationMenu x:Name="Menu" />
                </dxr:RibbonControl.ApplicationMenu>
            </dxr:RibbonControl>
            <dxr:RibbonStatusBarControl DockPanel.Dock="Bottom">
                <dxr:RibbonStatusBarControl.LeftItemLinks>
                    <!--<dxb:BarStaticItemLink  BarItemName="barStaticItem1" BarItemDisplayMode="Content" />-->
                </dxr:RibbonStatusBarControl.LeftItemLinks>
                <dxr:RibbonStatusBarControl.RightItemLinks>
                    <dxb:BarStaticItemLink  BarItemName="barStaticItem2" BarItemDisplayMode="Content" />
                </dxr:RibbonStatusBarControl.RightItemLinks>
            </dxr:RibbonStatusBarControl>
            <dxdo:DockLayoutManager  x:Name="dockLayoutManager1" ClosingBehavior="ImmediatelyRemove">
                <dxdo:LayoutGroup Caption="LayoutRoot">
                    <dxdo:DocumentGroup x:Name="GRP_Group" ItemWidth="1.52*"  ItemsSource="{Binding SubModels}" ClosingBehavior="ImmediatelyRemove">
                        <dxdo:DocumentGroup.ItemStyle>
                            <Style TargetType="{x:Type dxdo:DocumentPanel}">
                                <Setter Property="CloseCommand" Value="{Binding Close}" />
                                <Setter Property="IsActive" Value="{Binding IsActive, Mode=TwoWay, Converter={StaticResource ValueConverter}, ConverterParameter=Type}" />

                                <Setter Property="Caption" Value="{Binding DisplayName}" />
                                <Setter Property="ContentTemplate">
                                    <Setter.Value>
                                        <DataTemplate>
                                            <loki:BusyIndicator BusyContent="{Binding Status}" IsBusy="{Binding IsBusy}">
                                                <ContentPresenter Content="{TemplateBinding Content}" ContentTemplateSelector="{StaticResource LokiTemplateSelector}" />
                                            </loki:BusyIndicator>
                                        </DataTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </dxdo:DocumentGroup.ItemStyle>
                    </dxdo:DocumentGroup>
                </dxdo:LayoutGroup>
            </dxdo:DockLayoutManager>
        </DockPanel>
    </dxb:BarManager>
</loki:RibbonViewWindow>